# $Id: PKGBUILD 182370 2013-04-09 18:07:19Z ioni $
# Maintainer : Ionut Biru <ibiru@archlinux.org>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgbase=mtr
pkgname=(mtr mtr-gtk)
pkgver=0.84
pkgrel=1
arch=('i686' 'x86_64')
license=('GPL')
makedepends=('ncurses' 'gtk2')
source=(ftp://ftp.bitwizard.nl/mtr/$pkgbase-$pkgver.tar.gz)
url="http://www.bitwizard.nl/mtr/"
md5sums=('df61096ae1b18b27f915feeb907ae48c')

build() {
    cp -r  $pkgbase-$pkgver $pkgbase-cli
    cd mtr-cli
    ./configure --prefix=/usr --without-gtk
    make

    cd "$srcdir/$pkgbase-$pkgver"
    ./configure --prefix=/usr
    make
}

package_mtr() {
    pkgdesc="Combines the functionality of traceroute and ping into one tool (CLI version)"
    depends=('ncurses' 'glib2')
    cd mtr-cli
    make DESTDIR="$pkgdir" install
}

package_mtr-gtk() {
    pkgdesc="Combines the functionality of traceroute and ping into one tool (GTK version)"
    depends=('ncurses' "gtk2")
    conflicts=("mtr")
    provides=("mtr=$pkgver")

    cd $pkgbase-$pkgver
    make DESTDIR="$pkgdir" install
}
